package me.zhengjie.modules.system.utils.common;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class NoUtil {


    public static final String PREFIX = "JJ";

    public static synchronized String getOrderNo(int digit) {
        StringBuilder resultBuffer = new StringBuilder();
        resultBuffer.append(PREFIX)
                .append(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
        Random random = new Random();
        for (int i = 0; i < digit; i++) {
            resultBuffer.append(random.nextInt(10));
        }
        return resultBuffer.toString();
    }

}
